#ifndef _RESULT_H
#define _RESULT_H
#include"any.h"
#include"task.h"
#include"semaphore.h"
#include<memory>
#include<atomic>
class Task;
class Result
{
public:
Result(std::shared_ptr<Task> ,bool isValid = true);
~Result()=default;
Any get();
void SetVal(Any any);
private:
   Any any_;//存储任务的返回值
   Semaphore sem_;//线程通信信号量
   std::shared_ptr<Task> task_;//指向对应获取返回值的任务对象
   std::atomic_bool isValid_;//返回任务是否有效
};
#endif